package Daos;
import java.sql.*;
import java.util.ArrayList;
public abstract class DaoObject 
{
	protected Connection connection;
	protected Driver driver;
	public DaoObject()
	{
		
	}
	public void open()
	{
		try
		{
			String user = "sos";
			String pass = "csrocks55";
			String driverName = "com.mysql.jdbc.Driver";
			String url = "jdbc:mysql://cs.stonehill.edu:3306/sos";
			driver = (java.sql.Driver) Class.forName(driverName).newInstance();
			connection = DriverManager.getConnection(url, user, pass);
			
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
	public void close()
	{
		try
		{
			connection.close();
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}
	}
	public abstract void delete(Object value); 
	public abstract void insert(Object value);
	public abstract ArrayList<Object> selectAll();
	public abstract void update(Object value);
	public abstract Object find(Object value); //returns something if found, null if not
	protected abstract int indexOf(ArrayList<Object> list, Object value);
}
